Getting Equipment

 

Array GetComponents(typeName: string);

Called to get an array of all the components used within the project of the specified type

Parameters

Name Type Description
typeName String The name of the component type required

Return Value Array of requested type

Example:

// typeName can be one of the following:
//
// 'Barcode Scanner'
// 'Basic Shape'
// 'Cam Pusher'
// 'Chute'
// 'Conveyor'
// 'Conveyor Controller'
// 'Cross Belt Sorter'
// 'Divert Rule'
// 'Diverter'
// 'EStop'
// 'Free Roller Conveyor'
// 'Grid'
// 'Handler Group'
// 'High Speed Diverter'
// 'Label'
// 'Path'
// 'PE Sensor'
// 'Polyline'
// 'Product Generator'
// 'Product Schedule'
// 'Rack'
// 'Screening Operator Group'
// 'Shoe Sorter'
// 'Tilt Tray Sorter'
// 'Vertical Sorter'
// 'X-Ray Machine'

var conveyors = GetComponents("Conveyor");
ListEquipment("Conveyor", conveyors);
				
function ListEquipment(type, list) {
            
	LogDebug("List of all '" + type + "':")
	// loop through each equipment
	for (var i=0; i<list.length; i++) {
            
		LogDebug("    " + list[i].Name); 
	}    
}

object GetComponentByNameAndType(name: string, typeName: string);

Called to retrieve a component object.

Parameters

Name Type Description
name String The name assigned to the component
typeName String The type name of the required component

Return Value - Object.

Returns the requested component as a javascript object, or null if the component is not found.

Example:

var ATR1 = GetComponentByNameAndType('ATR1', 'Barcode Scanner');
var BasicShape1 = GetComponentByNameAndType('BasicShape1', 'Basic Shape');
var CamPusher1 = GetComponentByNameAndType('CamPusher1', 'Cam Pusher');
var Chute1 = GetComponentByNameAndType('Chute1', 'Chute');
var Conveyor1 = GetComponentByNameAndType('Conveyor1', 'Conveyor');
var ConveyorController1 = GetComponentByNameAndType('ConveyorController1', 'Conveyor Controller');
var CrossBeltSorter1 = GetComponentByNameAndType('CrossBeltSorter1', 'Cross Belt Sorter');
var DivertRule1 = GetComponentByNameAndType('DivertRule1', 'Divert Rule');
var Diverter1 = GetComponentByNameAndType('Diverter1', 'Diverter');
var EStop1 = GetComponentByNameAndType('EStop1', 'EStop');
var FreeRollerConveyor1 = GetComponentByNameAndType('FreeRollerConveyor1', 'Free Roller Conveyor');
var Grid1 = GetComponentByNameAndType('Grid1', 'Grid');
var HandlerGroup1 = GetComponentByNameAndType('HandlerGroup1', 'Handler Group');
var HighSpeedDiverter1 = GetComponentByNameAndType('HighSpeedDiverter1', 'High Speed Diverter');
var Label1 = GetComponentByNameAndType('Label1', 'Label');
var Path1 = GetComponentByNameAndType('Path1', 'Path');
var PESensor1 = GetComponentByNameAndType('PESensor1', 'PE Sensor');
var Polyline1 = GetComponentByNameAndType('Polyline1', 'Polyline');
var ProductGenerator1 = GetComponentByNameAndType('ProductGenerator1', 'Product Generator');
var ProductSchedule1 = GetComponentByNameAndType('ProductSchedule1', 'Product Schedule');
var Rack1 = GetComponentByNameAndType('Rack1', 'Rack');
var ScreeningOperatorGroup1 = GetComponentByNameAndType('OperatorGroup1', 'Screening Operator Group');
var ShoeSorter1 = GetComponentByNameAndType('ShoeSorter1', 'Shoe Sorter');
var TiltTraySorter1 = GetComponentByNameAndType('TiltTraySorter1', 'Tilt Tray Sorter');
var VerticalSorter1 = GetComponentByNameAndType('VerticalSorter1', 'Vertical Sorter');
var XRayMachine1 = GetComponentByNameAndType('XRayMachine1', 'X-Ray Machine');			

object GetComponentByID(id: string);

Called to retrieve a component object.

Parameters

Name Type Description
Id String The id assigned to the component, this value is assigned internally and is not configurable. It is intended for use in retrieving components when only the id is known. The id is usually an integer 64 but the function is using a string as parameter.

Return Value - Object.

Returns the requested component as a javascript object or null if the component is not found.

Example:

var myChute = GetComponentByID("3355751780515315775");
LogDebug("My Chute name is " + myChute.Name);

object GetComponentByName(name: string); (deprecated, use GetComponentByNameAndType)

Called to retrieve a component object.

Parameters

Name Type Description
name String The name assigned to the component

Return Value - Object

Returns the requested component as a javascript object, or null if the component is not found.

object GetProductFromID(identifier: string);

Called to retrieve a product object based on the identifier supplied as a parameter in the function call UpdateProductPosition (see Product Tracking)

Parameters

Parameter Name Type Description
identifier String The id assigned to the product

Return Value - Object

Returns the requested product as a javascript object, or null if it is not found.